#include "JProjectWizard.h"
#include "JProject.h"
#include "JLog.h"

#include <QMessageBox>
#include <QDir>

JProjectWizard::JProjectWizard(QWidget *parent)
	: QWizard(parent)
{
	ui.setupUi(this);
	ui.wizardPage->setTitle("Welcome to JointMD Project Wizard");
	ui.wizardPage->setSubTitle("Please select the project type and complete all fields");
}

JProjectWizard::~JProjectWizard()
{

}

void JProjectWizard::accept()
{
	if (ui.nameLineEdit->text().isEmpty())
	{
		QMessageBox::information(this,"Error","The name field must be completed to create a new project.");
		return;
	}

	if (ui.folderCheckBox->isChecked())
	{
		QDir::setCurrent(QDir::currentPath()+"/"+ui.nameLineEdit->text());
	}

	if (ui.lowercaseCheckBox->isChecked())
	{
		//Project.Load(ui.nameLineEdit->text(),
		//	QDir::currentPath()+ui.nameLineEdit->text().toLower());
	}
	else
	{
		//Project.Load(QDir::currentPath()+"/"+ui.nameLineEdit->text());
	}

	Log.Post(QDir::current().absolutePath());

	QDialog::accept();
}